home *** CD-ROM | disk | FTP | other *** search
/ All for Cell Phones: Sony Ericsson / Sony-Ericsson 2004.iso / Java / Chess / Fly_Chess.jar / Properties.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-08-23  |  2.5 KB  |  62 lines

  1. import javax.microedition.lcdui.Command;
  2. import javax.microedition.lcdui.CommandListener;
  3. import javax.microedition.lcdui.Display;
  4. import javax.microedition.lcdui.Displayable;
  5. import javax.microedition.lcdui.Form;
  6.  
  7. public class Properties implements CommandListener {
  8.    private Form props;
  9.    private StringBuffer propbuf;
  10.    private Command backCommand = new Command("Back", 2, 1);
  11.    private ChessDisplayable back;
  12.  
  13.    public Properties(ChessDisplayable var1) {
  14.       this.back = var1;
  15.       this.propbuf = new StringBuffer(50);
  16.       this.props = new Form("System Properties");
  17.    }
  18.  
  19.    public void commandAction(Command var1, Displayable var2) {
  20.       if (var1 == this.backCommand) {
  21.          this.back.makeCurrent(CU.getDisplay());
  22.       }
  23.  
  24.    }
  25.  
  26.    public void makeCurrent(Display var1) {
  27.       Runtime var2 = Runtime.getRuntime();
  28.       var2.gc();
  29.       long var3 = var2.freeMemory();
  30.       long var5 = var2.totalMemory();
  31.       this.props.append("Free Memory = " + var3 + "\n");
  32.       this.props.append("Total Memory = " + var5 + "\n");
  33.       this.props.append(this.showProp("microedition.configuration"));
  34.       this.props.append(this.showProp("microedition.profiles"));
  35.       this.props.append(this.showProp("microedition.platform"));
  36.       this.props.append(this.showProp("microedition.locale"));
  37.       this.props.append(this.showProp("microedition.encoding"));
  38.       this.props.append(this.showProp("microedition.encodingClass"));
  39.       this.props.append(this.showProp("microedition.http_proxy"));
  40.       this.props.addCommand(this.backCommand);
  41.       this.props.setCommandListener(this);
  42.       var1.setCurrent(this.props);
  43.    }
  44.  
  45.    String showProp(String var1) {
  46.       String var2 = System.getProperty(var1);
  47.       this.propbuf.setLength(0);
  48.       this.propbuf.append(var1);
  49.       this.propbuf.append(" = ");
  50.       if (var2 == null) {
  51.          this.propbuf.append("<undefined>");
  52.       } else {
  53.          this.propbuf.append("\"");
  54.          this.propbuf.append(var2);
  55.          this.propbuf.append("\"");
  56.       }
  57.  
  58.       this.propbuf.append("\n");
  59.       return this.propbuf.toString();
  60.    }
  61. }
  62.